<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="admin/common/html/tableHead :: tableHead(~{::title},~{::link},~{::style})">

	<title th:text=${title}></title>
	<!-- 这儿引用单独的css link -->
	<!-- Ladda for Bootstrap 3按钮加载进度插件 -->
	<link rel="stylesheet" th:href="@{/static/admin/assets/js/button/ladda/ladda.min.css}">
	<!-- bootstrap-table表单样式 -->
	<link th:href="@{/static/admin/assets/js/bootstrap/css/bootstrap-table/bootstrap-table.min.css}" rel="stylesheet"/>

	<style type="text/css">

		body {
			color: #9ea7b3;
			font-family: "Open Sans", Arial, sans-serif !important;
			font-size: 13px !important;
			line-height: 20px;
			overflow-x: hidden !important;
			min-height: 100%;
			z-index: -2;
			margin: 0px !important;
			background-image: none;
			-moz-background-size: cover;
			-webkit-background-size: cover;
			-o-background-size: cover;
			background-size: cover;
		}

		label.error {
			position: absolute;
			right: 18px;
			top: 5px;
			color: #ef392b;
			font-size: 12px;
		}

		.ico-list .fa {
			margin: 5px;
			padding: 5px;
			cursor: pointer;
			font-size: 18px;
			width: 28px;
			border-radius: 3px;
		}

		.ico-list .fa:hover {
			background-color: #1d9d74;
			color: #ffffff;
		}
	</style>

</head>

<body>
      	   	      	      	      	      	      
<div class="content-wrap">
	<div class="row">
		<div class="col-sm-12">
			<div class="nest" id="elementClose">
				<div class="">
				</div>
				<div class="body-nest" id="element">
					<div class="panel-body">
						<form  class="form-horizontal layui-form" id="form-edit" th:object="${OrganDic}">
							<input id="id" name="id" type="hidden" th:field="*{id}"/>
						
									<div class="form-group">
										<label class="col-sm-3 control-label ">名称：</label>
										<div class="col-sm-8">
											<input class="form-control" type="text" id="tName" name="tName" th:value="*{tName}"/>
										</div>
									</div>

								
									<!-- <div class="form-group">
										<label class="col-sm-3 control-label ">父节点：</label>
										<div class="col-sm-8">
											<input class="form-control" type="text" id="pid" name="pid" th:value="*{pid}"/>
										</div>
									</div> -->
									<div   class="form-group">
										<label class="col-sm-3 control-label ">上级菜单：</label>
										<div class="col-sm-8">
											<input class="form-control" type="hidden" id="pid" name="pid" th:value="*{pid}"/>
											<input class="form-control" readonly="true" type="text" id="pidName" th:value="${ParOrganDic.tName}" onclick="selectMenuTree()"/>
										</div>
									</div>

								
									<div class="form-group">
										<label class="col-sm-3 control-label ">状态：</label>
										<div class="col-sm-8">
											<!-- <input class="form-control" type="text" id="status" name="status" th:value="*{status}"/> -->
											<select class="form-control" th:field="*{status}" th:value="*{status}"   id="status" name="status" >
											  <option th:selected="*{status=='禁用'}" value="0">禁用</option>
										      <option th:selected="*{status=='启用'}" value="1">启用</option>
										    </select>
										</div>
									</div>
								
									<div class="form-group">
										<label class="col-sm-3 control-label ">机构类型：</label>
										<div class="col-sm-8">
											<!-- <input class="form-control" type="text" id="tType" name="tType" th:value="*{tType}"/> -->
											<select class="form-control" th:field="*{tType}" th:value="*{tType}"   id="tType" name="tType" >
											  <option th:selected="*{tType=='残联单位'}" value="0">残联单位</option>
										      <option th:selected="*{tType=='爱心家园'}" value="1">爱心家园</option>
										    </select>
										</div>
									</div>
									
									<div class="form-group layui-form-item">
										<label class="col-sm-3 control-label ">权限授权：</label>
										<div class="col-sm-8">
									    	<div th:each="m : ${tsysUserList}" th:if="${m.nickname} ne '超级管理员'" >
												<input th:id="${m.id}" th:checked="${m.organId eq OrganDic.id}" class="sqcheckbox" name="userIds"  th:value="${m.id}" type="checkbox" th:title="${m.nickname}" />
											</div>
										</div>
									</div> 
			
									<div class="form-group">
										<div class="form-control-static col-sm-offset-9">
											<button type="submit" class="btn btn-primary">提交</button>
											<button onclick="$.modal.close()" class="btn btn-danger" type="button">关闭</button>
										</div>
									</div>
						</form>
					</div>
				</div>
			</div>
		</div>
	</div>
</div>

<!-- 通用js -->
<div th:include="admin/common/html/js :: onload_js">
   
</div>
<!-- bootstarp 表格 -->
<script th:src="@{/static/admin/assets/js/bootstrap/js/bootstrap-table/bootstrap-table.min.js}" type="text/javascript"></script>
<script th:src="@{/static/admin/assets/js/bootstrap/js/bootstrap-table/locale/bootstrap-table-zh-CN.min.js}" type="text/javascript"></script>
<script th:src="@{/static/admin/assets/js/bootstrap/js/base_list.js}" type="text/javascript"></script>


<!-- 弹窗 -->
<!-- 遮罩层 -->
<script th:src="@{/static/admin/assets/js/blockUI/jquery.blockUI.js}" type="text/javascript"></script>
<script type="text/javascript">



$("#form-edit").validate({
	submitHandler : function(form) {
		edit();
	}
});

function edit() {
	var dataFormJson = $("#form-edit").serialize();
	$.ajax({
		cache : true,
		type : "POST",
		url : rootPath + "/OrganDicController/edit",
		data : dataFormJson,
		async : false,
		error : function(request) {
			$.modal.alertError("系统错误");
		},
		success : function(data) {
			$.operate.saveSuccess(data);
		}
	});
}

/*菜单管理-修改-选择菜单树*/
function selectMenuTree() {
	var url = rootPath + "/OrganDicController/tree";
	$.modal.open("选择菜单", url, '380', '380');
}
</script>

</body>


</html>
